home *** CD-ROM | disk | FTP | other *** search
/ Thinkin' Science - 1st & 2nd Grades / Thinkin' Science - First and Second Grades (Edmark)(Version 1.0)(1997).ISO / pc / edinst / wing / wing.mst < prev    next >
Text File  |  1996-04-19  |  11KB  |  393 lines

  1. '**************************************************************************
  2. '*                       WinG Setup Program
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME       = 100
  11. CONST ASKQUIT       = 200
  12. CONST DESTPATH      = 300
  13. CONST DESTPATH2     = 301
  14. CONST EXITFAILURE   = 400
  15. CONST EXITQUIT      = 600
  16. CONST EXITSUCCESS   = 700
  17. CONST APPHELP       = 900
  18. CONST CHECK         = 2500
  19. CONST BADPATH       = 6400
  20. CONST RESTART       = 1000
  21.  
  22. ''File Types
  23. CONST WING_RUNFILES     = 1
  24. CONST WING_BUILDFILES   = 2
  25.  
  26. ''Bitmap ID
  27. CONST LOGO = 1
  28.  
  29. GLOBAL FILEDIALOG   ''File path dialog ID
  30.  
  31. GLOBAL DEST$        ''Default destination directory.
  32.  
  33. GLOBAL CHECKSTATES$ ''Dialog list symbol names
  34. GLOBAL WINDRIVE$    ''Windows drive letter.
  35.  
  36. GLOBAL TMPDEST$        '' tmpfile destination
  37.  
  38. GLOBAL bInstallDVA%
  39.  
  40. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  41. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  42. DECLARE SUB UpdateWinG32 (szOrig$) 
  43.  
  44. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  45. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  46. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  47. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  48. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  49. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) 
  50.  
  51. INIT:
  52.     bInstallDVA% = 0
  53.     
  54.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  55.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  56.  
  57.     SetBitmap CUIDLL$, LOGO
  58.     SetTitle "Microsoft WinG Setup"
  59.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  60.     IF szInf$ = "" THEN
  61.     szInf$ = GetSymbolValue("STF_CWDDIR") + "wing.inf"
  62.     END IF
  63.     ReadInfFile szInf$
  64.  
  65. WELCOME:
  66.     'sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  67.     'IF sz$ = "CONTINUE" THEN
  68.     'UIPop 1
  69.     'ELSE
  70.     'GOSUB ASKQUIT
  71.     'GOTO WELCOME
  72.     'END IF
  73.  
  74.  
  75.     CHECKSTATES$ = "CheckItemsIn"
  76.     AddListItem CHECKSTATES$, "ON"
  77.     AddListItem CHECKSTATES$, "OFF"
  78.     'AddListItem CHECKSTATES$, "ON"
  79.  
  80. CHECK:
  81.     'sz$ = UIStartDlg(CUIDLL$, CHECK, "FCheckDlgProc", APPHELP, HELPPROC$)
  82.     'IF sz$ = "CONTINUE" THEN
  83.     'UIPop 1
  84.     'ELSE
  85.     'GOSUB ASKQUIT
  86.     'GOTO CHECK
  87.     'END IF
  88.  
  89.     CHECKSTATES$ = "CheckItemsOut"
  90.     'IF GetListItem(CHECKSTATES$, WING_RUNFILES) = "ON" THEN
  91.  
  92.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  93.     DEST$ = GetWindowsSysDir
  94.     
  95.     AddSectionFilesToCopyList "runtime", SrcDir$, DEST$
  96.     
  97.            '
  98.     ' only use DVA on Windows 3.x
  99.     '
  100.     IF OnWin3x() = 1 THEN
  101.         AddSectionFilesToCopyList "dva", SrcDir$, DEST$
  102.         IF VflatdPresent() = 0 THEN
  103.         CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
  104.         bInstallDVA% = 1
  105.         END IF
  106.     END IF
  107.     
  108.     DEST$ = GetRealWindowsSysDir
  109.     
  110.     AddSectionFilesToCopyList "wing32", SrcDir$, DEST$
  111.            Dest1$ = MakePath(DEST$,"wing32.dll")
  112.            Dest2$ = MakePath(DEST$,"wing32.xxx")
  113.     RenameFilePlease Dest1$,Dest2$
  114.     
  115.     CopyFilesInCopyList
  116.     
  117.     UpdateWinG32 GetRealWindowsSysDir()
  118.  
  119.     'END IF
  120.  
  121.     'IF GetListItem(CHECKSTATES$, WING_BUILDFILES) = "ON" THEN
  122.     'WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  123.     'DEST$ = WINDRIVE$ + ":\WING"
  124.     'FILEDIALOG = DESTPATH2
  125.     'GOSUB GETPATH
  126.     'SrcDir$ = GetSymbolValue("STF_SRCDIR")
  127.     'CreateDir DEST$, cmoVital
  128.  
  129.     '' add devkit files to destination
  130.     
  131.     ' WinBug.exe taken out for first beta, maybe add it in later, and fix up .lyt file too!
  132.     'CreateDir MakePath(DEST$,"winbug"), cmoNone
  133.     'AddSectionFilesToCopyList "winbug", SrcDir$, MakePath(DEST$,"winbug")
  134.  
  135.     'CreateDir MakePath(DEST$,"bin"), cmoNone
  136.     'AddSectionFilesToCopyList "runtime", SrcDir$, MakePath(DEST$,"bin")
  137.     
  138.     'AddSectionFilesToCopyList "wing32", SrcDir$, MakePath(DEST$,"bin")
  139.            'Dest1$ = MakePath(DEST$,"bin\wing32.dll")
  140.            'Dest2$ = MakePath(DEST$,"bin\wing32.xxx")
  141.     'RenameFilePlease Dest1$,Dest2$
  142.     
  143.     'AddSectionFilesToCopyList "bin", SrcDir$, MakePath(DEST$,"bin")
  144.     'AddSectionFilestoCopyList "readme", SrcDir$, DEST$
  145.     'CreateDir MakePath(DEST$,"include"), cmoNone
  146.     'AddSectionFilesToCopyList "include", SrcDir$, MakePath(DEST$,"include")
  147.     'CreateDir MakePath(DEST$,"help"), cmoNone
  148.     'AddSectionFilesToCopyList "help", SrcDir$, MakePath(DEST$,"help")
  149.     'CreateDir MakePath(DEST$,"lib"), cmoNone
  150.     'AddSectionFilesToCopyList "lib", SrcDir$, MakePath(DEST$,"lib")
  151.     
  152.     'GOSUB ADDSAMPLEFILESTOLIST
  153.     'CopyFilesInCopyList
  154.     'UpdateWinG32 MakePath( DEST$, "bin" )
  155.     'GOSUB ADDGROUP
  156.     'END IF
  157.  
  158. QUIT:
  159.     ON ERROR GOTO ERRQUIT
  160.     
  161.     'IF ERR = 0 THEN
  162.     'dlg% = EXITSUCCESS
  163.     'ELSEIF ERR = STFQUIT THEN
  164.     'dlg% = EXITQUIT
  165.     'ELSE
  166.     'dlg% = EXITFAILURE
  167.     'END IF
  168.  
  169. QUITL1:
  170.  
  171.     'if dlg% = EXITSUCCESS AND bInstallDVA% = 1 then
  172.     'sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", APPHELP, HELPPROC$)
  173.     'UIPop 1
  174.     'IF sz$ = "CONTINUE" THEN
  175.     '    rc% = RestartWindows
  176.     'ENDIF
  177.     'endif
  178.  
  179.     'sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  180.     'IF sz$ = "REACTIVATE" THEN
  181.     'GOTO QUITL1
  182.     'END IF
  183.     'UIPop 1
  184.     
  185.     '' added by tlf 04/17/96
  186.     IF ERR = 0 AND bInstallDVA% = 1 THEN
  187.         LogFile$ = GetWindowsDir() + "_setup.log"
  188.         OpenLogFile  LogFile$, 0
  189.         WriteToLogFile "[WING]"
  190.         WriteToLogFile "RestartWindows=Yes"
  191.         CloseLogFile
  192.     ENDIF
  193.  
  194.  
  195.     END
  196.  
  197. ERRQUIT:
  198.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  199.     END
  200.  
  201.  
  202. BADPATH:
  203.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  204.     IF sz$ = "REACTIVATE" THEN
  205.     GOTO BADPATH
  206.     END IF
  207.     UIPop 1
  208.     RETURN
  209.  
  210.  
  211. ASKQUIT:
  212.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  213.  
  214.     IF sz$ = "EXIT" THEN
  215.     UIPopAll
  216.     ERROR STFQUIT
  217.     ELSEIF sz$ = "REACTIVATE" THEN
  218.     GOTO ASKQUIT
  219.     ELSE
  220.     UIPop 1
  221.     END IF
  222.     RETURN
  223.  
  224.  
  225. GETPATH:
  226.     SetSymbolValue "EditTextIn", DEST$
  227.     SetSymbolValue "EditFocus", "END"
  228.  
  229. GETPATHL1:
  230.     sz$ = UIStartDlg(CUIDLL$, FILEDIALOG, "FEditDlgProc", APPHELP, HELPPROC$)
  231.     DEST$ = GetSymbolValue("EditTextOut")
  232.  
  233.     IF sz$ = "CONTINUE" THEN
  234.     IF IsDirWritable(DEST$) = 0 THEN
  235.         GOSUB BADPATH
  236.         GOTO GETPATHL1
  237.     END IF
  238.     UIPop 1
  239.     ELSEIF sz$ = "REACTIVATE" THEN
  240.     GOTO GETPATHL1
  241.     ELSEIF sz$ = "BACK" THEN
  242.     UIPop 1
  243.     GOTO CHECK
  244.     ELSE
  245.     GOSUB ASKQUIT
  246.     GOTO GETPATH
  247.     END IF
  248.  
  249.     RETURN
  250.  
  251. ADDSAMPLEFILESTOLIST:
  252.     SamplePath$ = MakePath(DEST$,"samples")
  253.     CreateDir SamplePath$, cmoNone
  254.  
  255. '       Add doggie example program
  256.  
  257.     sample$ = "doggie"
  258.  
  259.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  260.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  261.  
  262. '       Add cube example program
  263.  
  264.     sample$ = "cube"
  265.  
  266.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  267.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  268.  
  269. '       Add utils example code
  270.  
  271.     sample$ = "utils"
  272.  
  273.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  274.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  275.  
  276. '       Add timewing example program
  277.  
  278.     sample$ = "timewing"
  279.  
  280.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  281.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  282.  
  283. '       Add halftone example program
  284.  
  285.     sample$ = "halftone"
  286.  
  287.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  288.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  289.  
  290. '       Add palanim example program
  291.  
  292.     sample$ = "palanim"
  293.  
  294.     CreateDir MakePath(SamplePath$,sample$), cmoNone
  295.     AddSectionFilesToCopyList sample$, SrcDir$, MakePath(SamplePath$,sample$)
  296.  
  297. '       Other sample programs go here
  298.  
  299.     RETURN
  300.     
  301. ADDGROUP:
  302.     SamplePath$ = MakePath(DEST$,"samples")
  303.     proggroup$ = "WinG SDK"
  304.     CreateProgmanGroup proggroup$, "", cmoNone
  305.     
  306.         path$ = MakePath( DEST$, "help\wing.hlp" )
  307.     CreateProgmanItem proggroup$, "WinG Help", "winhelp "+path$, "", cmoOverwrite
  308.     
  309.         path$ = MakePath( DEST$, "bin\wingbug.exe" )
  310.     CreateProgmanItem proggroup$, "WinG Bug Reporting Tool", path$, "", cmoOverwrite
  311.     
  312.     path$ = MakePath( SamplePath$,"doggie\doggie.exe")
  313.     CreateProgmanItem proggroup$, "Doggie", path$, "", cmoOverwrite
  314.     
  315.     path$ = MakePath( SamplePath$,"cube\cube.exe")
  316.     CreateProgmanItem proggroup$, "Cube",path$,"", cmoOverwrite
  317.     
  318.     path$ = MakePath( SamplePath$,"timewing\timewing.exe")
  319.     CreateProgmanItem proggroup$, "Time WinG",path$,"", cmoOverwrite
  320.     
  321.     path$ = MakePath( SamplePath$,"halftone\halftone.exe")
  322.     CreateProgmanItem proggroup$, "Halftone",path$,"", cmoOverwrite
  323.     
  324.     path$ = MakePath( SamplePath$,"palanim\palanim.exe")
  325.     CreateProgmanItem proggroup$, "Palette Animation",path$,"", cmoOverwrite
  326.     
  327. '       Other sample programs get added here
  328.     
  329.     RETURN
  330.  
  331. '**
  332. '** Purpose:
  333. '**     Appends a file name to the end of a directory path,
  334. '**     inserting a backslash character as needed.
  335. '** Arguments:
  336. '**     szDir$  - full directory path (with optional ending "\")
  337. '**     szFile$ - filename to append to directory
  338. '** Returns:
  339. '**     Resulting fully qualified path name.
  340. '*************************************************************************
  341. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  342.     IF szDir$ = "" THEN
  343.     MakePath = szFile$
  344.     ELSEIF szFile$ = "" THEN
  345.     MakePath = szDir$
  346.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  347.     MakePath = szDir$ + szFile$
  348.     ELSE
  349.     MakePath = szDir$ + "\" + szFile$
  350.     END IF
  351. END FUNCTION
  352.  
  353.  
  354. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  355.     szBuf$ = string$(260, 32)
  356.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  357.     IF cbBuf% = 0 THEN
  358.         ERROR STFERR
  359.     ELSE
  360.         IF cbBuf% > 259 THEN
  361.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  362.             ERROR STFERR
  363.         END IF
  364.         szBuf$ = RTRIM$(szBuf$)
  365.         IF MID$(szBuf$, 1, 1) = "\" THEN
  366.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  367.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  368.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  369.         END IF
  370.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  371.             szBuf$ = szBuf$ + "\"
  372.         END IF
  373.         GetRealWindowsSysDir = szBuf$
  374.     END IF
  375.  
  376.     szBuf$ = ""
  377. END FUNCTION
  378.  
  379. SUB UpdateWinG32 (szOrig$) STATIC 
  380.     '
  381.     ' Here we check the version ourselves of wing32.dll, since 
  382.     ' we can't get version checking for Win32 apps from Win16
  383.     '
  384.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  385.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  386.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  387.     RemoveFile FileOrig$, cmoForce
  388.     ELSE
  389.         RemoveFile FileNew$, cmoForce        ' get rid of new file
  390.     RenameFilePlease FileOrig$,FileNew$    ' put back old file
  391.     END IF
  392. END SUB
  393.